package cn.iocoder.yudao.module.resource.enums;

import cn.hutool.core.util.ObjUtil;
import cn.iocoder.yudao.framework.common.core.ArrayValuable;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;

/**
 * 广告类型枚举
 *
 * @author 芋道源码
 */
@Getter
@AllArgsConstructor
public enum AdvertisementTypeEnum implements ArrayValuable<Integer> {

    REWARD_VIDEO(1, "激励视频"),
    BANNER(2, "Banner广告");

    public static final Integer[] ARRAYS = Arrays.stream(values()).map(AdvertisementTypeEnum::getType).toArray(Integer[]::new);

    /**
     * 类型值
     */
    private final Integer type;
    /**
     * 类型名
     */
    private final String name;

    @Override
    public Integer[] array() {
        return ARRAYS;
    }

    public static boolean isRewardVideo(Integer type) {
        return ObjUtil.equal(REWARD_VIDEO.type, type);
    }

    public static boolean isBanner(Integer type) {
        return ObjUtil.equal(BANNER.type, type);
    }

}
